package com.woniuxy.api;

import com.woniuxy.entity.Product;
import com.woniuxy.entity.ProductDTO;
import com.woniuxy.entity.utils.ResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

//@FeignClient("myh-product")
//@FeignClient(value = "myh-product",fallbackFactory = FallbackFactoryCommand.class)
@FeignClient(value = "myh-product")
@RequestMapping("/product")
public interface RemoteProductService {
    @GetMapping("/{pid}")
    ResponseEntity findOneByPid(@PathVariable("pid") Integer pid);

    @PutMapping
    ResponseEntity updateProduct(@RequestBody Product product);

//    @GetMapping("/findCondition")
//    public ResponseEntity findAllByNameOrPrice(@RequestParam("name") String name, @RequestParam("minPrice") double minPrice, @RequestParam("maxPrice") double maxPrice);

//    @GetMapping("/findCondition")
//    public ResponseEntity findAllByNameOrPrice(@SpringQueryMap Map map);

    @GetMapping("/findCondition")
    public ResponseEntity findAllByNameOrPrice(@SpringQueryMap ProductDTO productDTO);
}
